package modele.WorldElem;

import java.awt.Color;

import modele.Square;
import modele.World;

import controller.Rule;
import controller.Visitor;


public abstract class State implements Cloneable {
	private SecondaryState secondaryState;
	
	public static final int WATERSOURCE = 0;
	public static final int EARTH = 1;
	public static final int GRASS = 2;
	public static final int ROCK = 3;
	public static final int SAND = 4;
	public static final int TREE = 5;
	public static final int NBSTATE = 6;
	
	
	
	
	public State(){
		secondaryState= new None();
	}
	
	public State(SecondaryState ss){
		secondaryState = ss;
	}
	
	public abstract int getState();
	public abstract void evolve(Square s, World w);
	public abstract void accept(Visitor v);
	public abstract void applyRule(Rule r, Square s, World w);
	public abstract int getStateAdditionalAltitude();
	public abstract Color getColor(Square s); 
	public abstract Object clone();
	
	public int getSecondaryStateValue(){
		return secondaryState.getSecondaryStateValue();
	}
	
	public SecondaryState getSecondaryState(){
		return secondaryState;
	}
	public void setSecondaryState(SecondaryState secondaryState) {
		this.secondaryState = secondaryState;
	}
	
	public int getAdditionalAltitude(){
		return secondaryState.getAdditionalAltitude()+getStateAdditionalAltitude();
	}
	
	
}
